const app = getApp();
import {
  addressList,
  deleteAddress
} from "../../../server/api";
Page({
  data: {
    oss_url: app.globalData.oss_url,
    adsList: [],

  },
  onLoad: function (options) {
   
  },
  onShow(){
    this.getAddressList()
  },
  getAddressList(){
    let data={
      oneId: app.globalData.user_info.oneId
    }
    addressList(data).then(res=>{
      console.log(res.data)
      if(res.code==0){
        this.setData({
          adsList:res.data
        })
      }
    })
  },
  delete(e){
    let data={
      receiverId:e.currentTarget.dataset.id
    }
    deleteAddress(data).then(res=>{
      if(res.code==0){
        this.getAddressList()
      }
    })
  },
  radioChange(e){
    console.log(e)
  },
  edit(e){
    let { id,name,mobile,area,city,address,province}=e.currentTarget.dataset;
    wx.navigateTo({
      url: `/pages/goodsOrder/newAddAres/index?id=${id}&name=${name}&mobile=${mobile}&province=${province}&city=${city}&area=${area}&address=${address}`,
    })
  }
})